/*
 * Result_View.java
 *
 * Created on 2009年3月1日, 下午3:53
 */

package view;

import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import model.ResultView_Model;

/**
 *
 * @author  马凯
 */
public class Result_View extends javax.swing.JFrame {
    private TableColumnModel tcm;
    private TableColumn tc;
    private static Result_View rv;
    /** Creates new form Result_View */
    public Result_View() {
        initComponents();
        this.setLocationRelativeTo(null);
        tcm = this.result_Ta.getTableHeader().getColumnModel();
        tc = tcm.getColumn(0);
        tc.setHeaderValue("Name");
        tc = tcm.getColumn(1);
        tc.setHeaderValue("Student_ID");
        tc = tcm.getColumn(2);
        tc.setHeaderValue("Attend number");
        tc = tcm.getColumn(3);
        tcm.removeColumn(tc);
    }
    
    public static Result_View getInstance(){
        if(rv==null){
            rv = new Result_View();
        }
        return rv;
    }
    
    public ResultView_Model getViewModel(){
        ResultView_Model rvm = new ResultView_Model();
        rvm.setResult_Ta(result_Ta);
        return rvm;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        result_Ta = new javax.swing.JTable();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("ISC_SignIn");

        result_Ta.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(result_Ta);

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 285, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Result_View().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable result_Ta;
    // End of variables declaration//GEN-END:variables
    
}
